﻿/*=============================================================================
 TASK 3:                                                              {Methods}
 Write a method that returns the last digit of given integer as an English word.
 Examples: 512 -> "two", 1024 -> "four", 12309 -> "nine".
 =============================================================================*/

using System;

class LastDigit
{
    static void Main()
    {
        Console.Write("Enter number:");
        int n = int.Parse(Console.ReadLine());

        string lastDigit = LastDigitAsWord(GetLastDigit(n));

        Console.WriteLine("Last digit is:{0}", lastDigit);
    }

    static int GetLastDigit(int number)
    {
        return number % 10;
    }
    static string LastDigitAsWord(int number)
    {
        string digitName = "";
        switch (number)
        {
            case 0: digitName="zero";break;
            case 1: digitName = "one"; break;
            case 2: digitName = "two"; break;
            case 3: digitName = "three"; break;
            case 4: digitName = "four"; break;
            case 5: digitName = "five"; break;
            case 6: digitName = "six"; break;
            case 7: digitName = "seven"; break;
            case 8: digitName = "eight"; break;
            case 9: digitName = "nine"; break;
        }
        return digitName;
    }
}